package cn.cdut.yiwenqian.biz.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.cdut.yiwenqian.biz.interfaces.IKnownleadeManager;
import cn.cdut.yiwenqian.dao.interfaces.IToolDao;
import cn.cdut.yiwenqian.entity.CdutPostTools;
import cn.cdut.yiwenqian.util.MyPageToolVo;
@Service
@Transactional
public class KnownleadeManagerImpl implements IKnownleadeManager {

	@Resource
	private IToolDao iToolDao;
	
	@Override
	public CdutPostTools createTool(CdutPostTools tool) {
		return iToolDao.saveTool(tool);
	}

	@Override
	public MyPageToolVo<CdutPostTools> findAllTool(int page) {
		return iToolDao.fingToolByName(null, page);
	}

	@Override
	public CdutPostTools findToolById(Integer toolId) {
		return iToolDao.findToolById(toolId);
	}

	@Override
	public MyPageToolVo<CdutPostTools> findAllUserTool(Integer userId, int page) {
		return iToolDao.findToolByAhther(userId,page);
	}

	@Override
	public CdutPostTools updateTool(CdutPostTools tool) {
		iToolDao.updateTool(tool);
		return iToolDao.findToolById(tool.getUnumber());
	}

}
